package com.atguigu.spzx.product.service.impl;

import com.atguigu.spzx.model.entity.product.Category;
import com.atguigu.spzx.model.entity.product.ProductSku;
import com.atguigu.spzx.model.vo.h5.IndexVo;
import com.atguigu.spzx.product.mapper.CategoryMapper;
import com.atguigu.spzx.product.mapper.ProductSkuMapper;
import com.atguigu.spzx.product.service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @ClassName: IndexServiceImpl
 * @Package: com.atguigu.spzx.product.service.impl
 * @Description
 * @Author 孤妤
 * @Date: 2023/12/18 10:48
 */
@Service
@Transactional
public class IndexServiceImpl implements IndexService {
    @Autowired
    private CategoryMapper categoryMapper;
    @Autowired
    private ProductSkuMapper productSkuMapper;
    @Override
    @Transactional(readOnly = true)
    public IndexVo findIndexVo() {
        List<Category> categoryList = categoryMapper.selectCategory();
        List<ProductSku> productSkuList = productSkuMapper.selectProduct();
        IndexVo indexVo = new IndexVo();
        indexVo.setCategoryList(categoryList);
        indexVo.setProductSkuList(productSkuList);
        return indexVo;
    }
}
